import request from '@/utils/request';
import { commonProjectType } from '@/common/baseUrl.js';
// 首页获取服务包列表
export function getProduct(data) {
  return request({
    url: `/insuranceCards?skip=${data.skip}&limit=${data.limit}`,
    method: 'get'
  });
}

// 首页接口

export function getIndexData(patientId) {
  return request({
    url: `/gyxm/home?patientId=${patientId}&projectType=${commonProjectType}`,
    method: 'get'
  });
}

// 首页广告位接口 /wcm/adpositions/ads
export function getAds(positionName) {
  //  项目小程序-首页-涨知识横幅
  return request({
    url: `/wcm/adpositions/ads?positionName=` + positionName,
    noAuth: true,
    method: 'get'
  });
}

// 查询保险订单状态
export function getInsureDetail(orderId) {
  //  项目小程序-首页-涨知识横幅
  return request({
    url: `/insurance_orders/${orderId}/insurance_team_order`,
    method: 'get'
  });
}

// 是否有健康评估

export function isPhysicalExamination(patientId) {
  return request({
    url: `/patients/${patientId}/isPhysicalExamination`,
    method: 'get'
  });
}

//  查询会员家庭成员保险订单
export function getFamilyInsurances(patientId, data) {
  let queryStr = '';
  let keys = Object.keys(data);
  for (let key of keys) {
    queryStr += '&' + key + '=' + data[key];
  }
  queryStr = queryStr.slice(1);
  return request({
    url: `/patients/${patientId}/familyInsurances?${queryStr}`,
    method: 'get',
    data
  });
}
export function getFamilyJoinCount(patientId) {
  return request({
    url: `/v2/patient/${patientId}/insurance_orders/insureds?projectType=${commonProjectType}`,
    method: 'get'
  });
}
